import request from '../utils/request'

export const delTeamService = (id) => {
  return request.delete('/teams/delete', {
    params: { id },
  })
}
//获取队伍列表
export const getTeamsInfoService = () => {
  return request.get('/teams/list')
}

//获取队伍详细信息
export const editTeamsService = (id) => {
  return request.get('/teams/detail', id)
}

// 更新队伍信息
export const updateTeamsService = (updateTeamsData) => {
  const params = new URLSearchParams()
  for (let key in updateTeamsData) {
    params.append(key, updateTeamsData[key])
  }
  return request.put('/teams/update', params)
}

//添加队伍
export const addTeamsService = (addTeamsData) => {
  //借助于UrlSearchParams完成传递
  const params = new URLSearchParams()
  for (let key in addTeamsData) {
    params.append(key, addTeamsData[key])
  }
  return request.post('/teams/add', params)
}
